//todo protectPrivacy 未实现
//新增 字段 formId, exist, more
// formType 类型 input select radio slot, 其中 slot 适用复杂情况, 需要更改框架页面内容(可能需要优化)

//框架默认配置
const extendSettings = [{
  fieldId: 'sex',
  formId: 'sex',
  displayText: '性别',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 1,
  contentSize: null,
  tiText: '请输入性别',
  validReg: null,
  connectAA10: 'SEX',
  formType:'radio',
  more: '0',
},{
  fieldId: 'jobNumber',
  formId: 'jobNumber',
  displayText: '工号',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 2,
  contentSize: null,
  tiText: '',
  validReg: '',
  connectAA10: null,
  formType: 'input',
  more: '0',
},{
  fieldId: 'idCardType',
  formId: 'idCardType',
  displayText: '证件类型',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 3,
  contentSize: null,
  tiText: '',
  validReg: '',
  connectAA10: 'IDCARDTYPE',
  formType: 'select',
  more: '0',
},{
  fieldId: 'idCardNo',
  formId: 'idCardNo',
  displayText: '证件号',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 4,
  contentSize: null,
  tiText: '',
  validReg: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
  connectAA10: null,
  formType: 'input',
  more: '0',
},{
  fieldId: 'mobile',
  formId: 'mobile',
  displayText: '手机号',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 5,
  contentSize: null,
  tiText: '',
  validReg: /^1[3|4|5|7|8|9][0-9]\d{8}$/,
  connectAA10: null,
  formType: 'input',
  more: '0',
},{
  fieldId: 'tags',
  formId: 'tags',
  displayText: '用户标签',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 6,
  contentSize: null,
  tiText: '',
  validReg: null,
  connectAA10: null,
  formType: 'slot',
  more: '0',
},{
  fieldId: 'education',
  formId: 'education',
  displayText: '学历',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 7,
  contentSize: null,
  tiText: '',
  validReg: null,
  connectAA10: 'EDUCATION',
  formType: 'select',
  more: '1',
},{
  fieldId: 'email',
  formId: 'email',
  displayText: '邮箱地址',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 8,
  contentSize: null,
  tiText: '',
  validReg: /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/,
  connectAA10: 'EDUCATION',
  formType: 'input',
  more: '1',
},{
  fieldId: 'address',
  formId: 'address',
  displayText: '联系地址',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 9,
  contentSize: null,
  tiText: '',
  validReg: null,
  connectAA10: null,
  formType: 'input',
  more: '1',
},{
  fieldId: 'zipCode',
  formId: 'zipCode',
  displayText: '邮政编码',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 10,
  contentSize: null,
  tiText: '',
  validReg: '/^[0-9]{6}$/',
  connectAA10: null,
  formType: 'input',
  more: '1',
},{
  fieldId: 'workplace',
  formId: 'workplace',
  displayText: '工作单位',
  hide: '0',
  effective: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 11,
  contentSize: null,
  tiText: '',
  validReg: null,
  connectAA10: null,
  formType: 'input',
  more: '1',
}]

//扩展属性默认配置
let extendSettingDefault = {
  fieldId: 'field',
  formId: 'field',
  displayText: '扩展信息',
  effective: '0',
  hide: '1',
  required: '0',
  unchangeable: '0',
  protectPrivacy: '0',
  orderNo: 1,
  contentSize: null,
  tiText: null,
  validReg: null,
  connectAA10: null,
  formType: 'input',
  more: '1',
}

//补位辅助函数
function PrefixInteger(num, n) {
  return (Array(n).join(0) + num).slice(-n);
}

//扩展属性个数
const extendLength = 10;

//构造合并, 返回有效队列
for(let i=1;i<=extendLength;i++){
  let setting = Object.assign({},extendSettingDefault)
  let field = PrefixInteger(i,2)
  setting.fieldId = setting.fieldId+field
  setting.formId = setting.formId+field
  setting.displayText = setting.displayText+field
  setting.orderNo = extendSettings.length + 1
  extendSettings.push(setting)
}

export default extendSettings
